package com.shen.grade;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Author:shen
 * CreateDate:2020/5/7.
 * Function:
 */
public class Grade {
    private String name;
    private String headerTeacher;
    private Date openDate;
    private static Map<Integer,Student> studentMap=new HashMap<>();
    private static int studentId=3;

    static {
        studentMap.put(1,new Student("张三",12));
        studentMap.put(2,new Student("李四",12));
        studentMap.put(3,new Student("王五",12));
    }

    /**
     * 添加学生
     * @param student
     */
    public void addStudent(Student student){
        studentMap.put(studentId++,student);
    }

    /**
     * 删除学生
     * @param index
     */
    public void deleteStudent(int index){
        studentMap.remove(index);
    }
    public Grade() {
    }

    public Grade(String name, String headerTeacher, Date openDate) {
        this.name = name;
        this.headerTeacher = headerTeacher;
        this.openDate = openDate;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHeaderTeacher() {
        return headerTeacher;
    }

    public void setHeaderTeacher(String headerTeacher) {
        this.headerTeacher = headerTeacher;
    }

    public Date getOpenDate() {
        return openDate;
    }

    public void setOpenDate(Date openDate) {
        this.openDate = openDate;
    }

    @Override
    public String toString() {
        return "Grade{" +
                "name='" + name + '\'' +
                ", headerTeacher='" + headerTeacher + '\'' +
                ", openDate=" + openDate +
                ",Students="+studentMap.toString()+ '\''+
                '}';
    }
}
